﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace Agents.Admin
{
    public partial class ShowOrders : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void backBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Admin/DateViewOrders.aspx");
        }

        /// <summary>
        /// Handle grid paging
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void dgOrders_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
        {
            // Updating the current page for the data grid to display
            dgOrders.CurrentPageIndex = e.NewPageIndex;

            // Re-Bind the data
            dgOrders.DataBind();
        }

        /// <summary>
        /// Occurs after binding is complete, and hides the data grid if there are no results
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e)
        {
            if (e.AffectedRows == 0)
            {
                dgOrders.Visible = false;
                lblMessage.Text = "אין הזמנות בתאריך זה";
            }
            else
            {
                lblMessage.Text = "";
            }
        }
    }
}